package io

import (
	"strconv"
	"../constants"
)

type Card struct {
	Id int
	Name string
	Value int
	Flower int
}

func (p *Card) ToString() string {
	return "Card Id=" + strconv.Itoa(p.Id) + ", Name=" + p.Name + ", Value=" + strconv.Itoa(p.Value) + ", Flower=" + strconv.Itoa(p.Flower)
}

type CardSlice []Card

var cards CardSlice

func NewCards() CardSlice {
	return cards[:]
}

func (c CardSlice) String() string {
	var str = ""

	for _, v := range c {
		str += v.ToString() + "\r\n"
	}

	return str
}

func init() {
	cards = CardSlice {
		Card{0, "3", 0, constants.FLOWER_SPADE},
		Card{1, "3", 0, constants.FLOWER_HEART},
		Card{2, "3", 0, constants.FLOWER_CLUB},
		Card{3, "3", 0, constants.FLOWER_DIAMOND},
		Card{4, "4", 1, constants.FLOWER_SPADE},
		Card{5, "4", 1, constants.FLOWER_HEART},
		Card{6, "4", 1, constants.FLOWER_CLUB},
		Card{7, "4", 1, constants.FLOWER_DIAMOND},
		Card{8, "5", 2, constants.FLOWER_SPADE},
		Card{9, "5", 2, constants.FLOWER_HEART},
		Card{10, "5", 2, constants.FLOWER_CLUB},
		Card{11, "5", 2, constants.FLOWER_DIAMOND},
		Card{12, "6", 3, constants.FLOWER_SPADE},
		Card{13, "6", 3, constants.FLOWER_HEART},
		Card{14, "6", 3, constants.FLOWER_CLUB},
		Card{15, "6", 3, constants.FLOWER_DIAMOND},
		Card{16, "7", 4, constants.FLOWER_SPADE},
		Card{17, "7", 4, constants.FLOWER_HEART},
		Card{18, "7", 4, constants.FLOWER_CLUB},
		Card{19, "7", 4, constants.FLOWER_DIAMOND},
		Card{20, "8", 5, constants.FLOWER_SPADE},
		Card{21, "8", 5, constants.FLOWER_HEART},
		Card{22, "8", 5, constants.FLOWER_CLUB},
		Card{23, "8", 5, constants.FLOWER_DIAMOND},
		Card{24, "9", 6, constants.FLOWER_SPADE},
		Card{25, "9", 6, constants.FLOWER_HEART},
		Card{26, "9", 6, constants.FLOWER_CLUB},
		Card{27, "9", 6, constants.FLOWER_DIAMOND},
		Card{28, "10", 7, constants.FLOWER_SPADE},
		Card{29, "10", 7, constants.FLOWER_HEART},
		Card{30, "10", 7, constants.FLOWER_CLUB},
		Card{31, "10", 7, constants.FLOWER_DIAMOND},
		Card{32, "JACK", 8, constants.FLOWER_SPADE},
		Card{33, "JACK", 8, constants.FLOWER_HEART},
		Card{34, "JACK", 8, constants.FLOWER_CLUB},
		Card{35, "JACK", 8, constants.FLOWER_DIAMOND},
		Card{36, "QUEEN", 9, constants.FLOWER_SPADE},
		Card{37, "QUEEN", 9, constants.FLOWER_HEART},
		Card{38, "QUEEN", 9, constants.FLOWER_CLUB},
		Card{39, "QUEEN", 9, constants.FLOWER_DIAMOND},
		Card{40, "KING", 10, constants.FLOWER_SPADE},
		Card{41, "KING", 10, constants.FLOWER_HEART},
		Card{42, "KING", 10, constants.FLOWER_CLUB},
		Card{43, "KING", 10, constants.FLOWER_DIAMOND},
		Card{44, "ACE", 11, constants.FLOWER_SPADE},
		Card{45, "ACE", 11, constants.FLOWER_HEART},
		Card{46, "ACE", 11, constants.FLOWER_CLUB},
		Card{47, "ACE", 11, constants.FLOWER_DIAMOND},
		Card{48, "2", 12, constants.FLOWER_SPADE},
		Card{49, "2", 12, constants.FLOWER_HEART},
		Card{50, "2", 12, constants.FLOWER_CLUB},
		Card{51, "2", 12, constants.FLOWER_DIAMOND},
		Card{52, "JOKER", 13, constants.FLOWER_NONE},
		Card{53, "JOKER KING", 14, constants.FLOWER_NONE},
	}
}